<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<style type="text/css">
		body, html, iframe, #ckfinder {
			margin: 0;
			padding: 0;
			border: 0;
			width: 100%;
			height: 100%;
			overflow: hidden;
		}
	</style>
	<script type="text/javascript" src="ckfinder.js"></script>
</head>
<body>
	<div id="ckfinder">
		<script type="text/javascript">
			(function(win){
				function GetUrlParms()    
				{
					 var args=new Object();   
					 var query=location.search.substring(1);//获取查询串   
					 var pairs=query.split("&");//在逗号处断开   
					 for(var    i=0;i<pairs.length;i++)   
					 {   
						 var pos=pairs[i].indexOf('=');//查找name=value   
							if(pos==-1)   continue;//如果没有找到就跳过   
							 var argname=pairs[i].substring(0,pos);//提取name   
							var value=pairs[i].substring(pos+1);//提取value   
							args[argname]=unescape(value);//存为属性   
					}
					 return args;
				}
				
				var get = CKFinder.tools.getUrlParam, tmp;
				
				var ckfinder = new CKFinder();
				ckfinder.width = ckfinder.height = '100%';
				ckfinder.selectActionFunction = onSelectAction;
				ckfinder.disableHelpButton = false;
				if ( tmp = get( 'type' ) ){
					ckfinder.resourceType = tmp;
				}
				
				ckfinder.create();
				
				function onSelectAction(fileUrl, data, allFiles){
					var args = new Object();
					args = GetUrlParms();
					var abs_url = args['abs_url'];
					var box = args['box'];
					var ptype = args['ptype'];
					var filetype = args['filetype'];
					var field = args['field'];
					
					if(filetype=='pic'){
						var str = '';
						for(var i=0,c=allFiles.length;i<c;i++){						
							str += '<dl><dt><img src="'+abs_url+allFiles[i].url+'"/></dt><dd class="picname"><div class="input-prepend"><span class="add-on">S</span><input type="text"  name="'+field+'_sort[]" value="0"/></div><div style="font-size:1px; height:5px;"></div><div class="input-prepend"><span class="add-on">T</span><input type="text"  name="'+field+'_title[]"/></div><input type="hidden" name="'+field+'_url[]" value="'+allFiles[i].url+'"/></dd><dd class="pictool"><span class="pdel"><i class="icon-remove-sign"></i></span> <span class="pzoom"><i class="icon-cut"></i></span> <span class="pshow"><i class="icon-eye-open"></i></span></dd></dl>';
						}
						if(ptype=='single'){
							window.parent.document.getElementById(box).innerHTML = str;
						}else{
							var old = window.parent.document.getElementById(box).innerHTML;
							window.parent.document.getElementById(box).innerHTML = old+str;
						}
						
						window.parent.$('.aui_close').click();
					}
				}
			})(window);
		</script>
	</div>
</body>
</html>